//
//  DistritosCreator.m
//  Futbol5Final
//
//  Created by Johan Chaves on 4/14/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "DistritosCreator.h"
#import "DistritosVO.h"

@implementation DistritosCreator


-(NSMutableArray *) createDistritos:(CantonVO*)pcanton :(NSDictionary *)distritosData{
    NSMutableArray * distritosResult = [[NSMutableArray alloc]init];
    
    DistritosVO *distritoVoTmp;
    
    NSMutableDictionary *distritoTmp = [[NSMutableDictionary alloc]init];
    
    NSString *ids;
    
    NSEnumerator *arrenum = [distritosData objectEnumerator];
    id cobj;   
    
    while ( cobj = [arrenum nextObject] ) {
        
        [distritoTmp setDictionary:cobj];
        ids = [distritoTmp objectForKey:@"id_distrito"];
        
        distritoVoTmp = [[DistritosVO alloc]initWithData: pcanton:[distritoTmp objectForKey:@"locales"]:[distritoTmp objectForKey:@"nombre"] :UITableViewCellStyleDefault :[ids intValue] reuseIdentifier:@"disitrito"];            
        
        [distritosResult addObject:distritoVoTmp];
        
        [distritoVoTmp release];
        [ids release];
        
    }
    
    [distritoTmp release];
    [cobj release];
    
    return distritosResult;
}

@end
